<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>ng-repeat</title>
	<script src="../org/angular.min.js"></script>
	</head>
	<body>
	    <div ng-app="hd" ng-controller="ctrl">
	    	<ul>
	    		<!--{$first}}选取第一个，{{$last}}最后一个，{{$even}}偶数，{{$odd}}奇数，{{$middle}}中间行-->
	    		<li ng-repeat='v in data'  style="{{$odd?'color:red':''}}">
	    			{{v.name + v.url}}
	    		</li></br>
	    		<li ng-repeat='v in data'>
	    			<span ng-if="$first" style="color: red;">{{v.name +' '+v.url}}</span>
	    			<span ng-if="$middle">{{v.name +' '+v.url}}</span>
	    			<span ng-if="$last" style="color: green;">{{v.name +' '+v.url}}</span>
	    		</li></br>
	    		<!--使用ng-repeat操作数组时，数组不能重复，使用index当唯一字段track by $index解决-->
	    		<li ng-repeat='v in infor track by $index'>
	    			{{v}}
	    		</li>
	    	</ul>
	    </div>
	    <script>
	    	var m = angular.module('hd',[]);
	    	m.controller('ctrl',['$scope',function($scope){
	    		$scope.data=[
	    		    {name:'百度',url:'www.baidu.com'},
	    		    {name:'网易',url:'www.wangyi.com'},
	    		    {name:'搜狐',url:'www.souhu.com'},
	    		    {name:'京东',url:'www.jd.com'},
	    		    {name:'滴滴',url:'www.didi.com'}
	    		];
	    		$scope.infor=['aaa',333,'bbb','bbb'];
	    	}])
	    </script>
	</body>
</html>
